<?php
class mlogin extends CI_Model{
	var $user = "user_management";

	function __construct()
	{
		parent::__construct();
	}
	
	function checkuser($username,$password){
		$this->db->where('username', $username);
		$this->db->where('password', $password);
		$query = $this->db->get($this->user);
		
		if($query->num_rows == 1){
			$row = $query->row_array();
			$data = array(
				'username' => $row['username'],
				'token' => md5($row['password'])
			);
			$this->session->set_userdata($data);
			
		    return true;
		}
	}
}
?>